import request from '@/utils/request';
import moment from 'moment';

// 获取下拉库数据，到达航站和出发航站的
export async function queryCityInfo(params) {
  return request('/dp/sys/getSelectCityInfo', {
    method: 'get',
    params,
  })
}

// 获取补偿合计列表信息
export async function irregularluggagesummaryTable(params) {
  return request('/luggage/sys/report/irregularluggagesummary', {
    method: 'get',
    params
  });
}
//导出补偿合计列表信息
export async function downloadluggagesummaryExcel(params) {
  return request('/luggage/sys/report/irregularluggagesummary/export', {
    method: 'get',
    responseType: 'blob',
    params
  });
}
// 获取补偿明细列表信息
export async function irregularluggagedetailTable(params) {

  params.planeType = params.planeType && params.planeType.join(',')

  return request('/luggage/sys/report/irregularluggagedetail', {
    method: 'get',
    params
  });
}
//导出补偿明细列表信息
export async function downloadluggagedetailExcel(params) {
  return request('/luggage/sys/report/irregularluggagedetail/export', {
    method: 'get',
    responseType: 'blob',
    params
  });
}
//  ===========成本分析表==============
export async function costdetail(params) {

  params['payBeginDate'] = params.payBeginDate ? params.payBeginDate.format('YYYY-MM-DD') : '';
  params['payEndDate'] = params.payEndDate ? params.payEndDate.format('YYYY-MM-DD') : '';
  params.isFlag = params.isFlag && params.isFlag.join(',')
  params.flightModel = params.flightModel && params.flightModel.join(',')
  params.flightType = params.flightType && params.flightType.join(',')
  params.receiveType = params.receiveType && params.receiveType.join(',')
  params.payStatus = params.payStatus && params.payStatus.join(',')
  params.applyStatus = params.applyStatus && params.applyStatus.join(',')
  params.isScene = params.isScene && params.isScene.join(',')
  params.payTypes = params.payTypes && params.payTypes.join(',')
  params.compensationType = '1'

  return request('/luggage/sys/report/costReportInfoPage', {
    method: 'get',
    params
  });
}

export async function exportCostbookdetail(params) {
  params.compensationType = '1';
  return request('/luggage/sys/report/costReportInfo/export', {
    method: 'post',
    responseType: 'blob',
    params
  });
}

// 标记or取消标记
export async function markFlag (params) {
  return request('/luggage/sys/report/updateFlag',{
    method: 'post',
    params
  })
}
// 一键标记
export async function quickMarkFlag(params) {
  return request('/luggage/sys/report/quickUpdateFlag', {
    method: 'post',
    params
  })
}

// 总计
export async function summary(params) {
  return request('/luggage/sys/report/summary', {
    method: 'get',
    params
  })
}
//  ===========支付明细表==============

//支付明细表
export async function paydetail(params) {

  params.payType = params.payType && params.payType.join(',')
  params.compensationType = '1'

  return request('/luggage/sys/report/payRecordInfoPage', {
    method: 'get',
    params
  });
}

export async function exportPaybookdetail(params) {
  params.compensationType = '1'
  return request('/luggage/sys/report/payRecordInfo/export', {
    method: 'get',
    responseType: 'blob',
    params
  });
}

//  ===========箱包报表==============

// 箱包报表
export async function pkgManageReport(params) {
  return request('/luggage/sys/report/pkgManageReport', {
    method: 'get',
    params
  });
}

// 箱包导出
export async function pkgManageReportExport(params) {
  return request('/luggage/sys/report/pkgManageReport/export', {
    method: 'get',
    responseType: 'blob',
    params
  });
}
